package com.sip.stream.utils.zfy.holder;


import com.sip.stream.ClientApp;
import com.sip.stream.R;
import com.sip.stream.databinding.ViewholderStatusBinding;
import com.sip.stream.utils.ZFYStatusType;
import com.sip.stream.utils.zfy.adapter.BaseDataBindingViewHolder;
import com.sip.stream.utils.zfy.listener.DataBindingViewHolderClickListener;
import com.sip.stream.utils.zfy.status.ZFYStatus;

public class ZFYStatusViewHolder extends BaseDataBindingViewHolder<ViewholderStatusBinding, String> {
    public ZFYStatusViewHolder(ViewholderStatusBinding viewholderStatusBinding, DataBindingViewHolderClickListener<String> dataBindingViewHolderClickListener) {
        super(viewholderStatusBinding, dataBindingViewHolderClickListener);
    }

    @Override
    public void onBindViewHolder(int i, String str) {
        super.onBindViewHolder(i, str);
        if (str.equalsIgnoreCase(ZFYStatusType.GPS)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.ic_vector_gps_h));
        } else if (str.equalsIgnoreCase(ZFYStatusType.GPS_UNABLE)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.ic_vector_gps_n));
        } else if (str.equalsIgnoreCase(ZFYStatusType.BLUETOOTH)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_ble));
        } else if (str.equalsIgnoreCase(ZFYStatusType.AIRPLANE)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_airplane));
        } else if (str.equalsIgnoreCase(ZFYStatusType.WIFI)) {
            setWifi();
        } else if (str.equalsIgnoreCase(ZFYStatusType.USB)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_usb));
        } else if (str.equalsIgnoreCase(ZFYStatusType.LOCK)) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.ic_vector_lock));
        }
    }

    private void setWifi() {
        int wifiSignalLevel = ZFYStatus.getInstance().getWifiSignalLevel();
        if (wifiSignalLevel == 1) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_wifi_1));
        } else if (wifiSignalLevel == 2) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_wifi_2));
        } else if (wifiSignalLevel == 3) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_wifi_3));
        } else if (wifiSignalLevel == 4) {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_wifi_4));
        } else {
            this.binding.ivContent.setImageDrawable(ClientApp.clientApp.getDrawable(R.drawable.status_wifi_0));
        }
    }
}
